﻿<?php
include_once("./function.php");
//2数据处理
//extract($_POST);//	$title $uname $content $sub $text
extract($_GET);//	$title $uname $content $sub $text
$content=trim($content);
$text=trim($text);
//3判断修改分类名是否为空
if(isset($title)&&isset($uname))
{
	$title=trim($title);
	$uname=trim($uname);
	if(empty($title)||empty($uname)||empty($content))
	{
	msg("配置项标题,名称,内容不能为空","sys_conf.php");exit;
	}
}
//4判断修改的分类名是否重复
$sql="select * from ts_sysconfig where sys_name='$uname' and sys_id!=$sid";
$res=mysqli_query($link,$sql);
if(is_object($res))
{
	if(mysqli_num_rows($res)>0)
	{
		msg("修改的分类名不能重复","sys_conf.php");exit;
	}

}
/*if($_GET['sid']<4)
{
	
}*/
//5修改分类
if(isset($_GET['sid']))
{
	$sql="update ts_sysconfig set sys_name='$uname',sys_title='$title',sys_val='$content',sys_type='$text' where sys_id='$sid'";
	$res=mysqli_query($link,$sql);
		if(mysqli_affected_rows($link)>0)
			{
				msg("修改成功","sys_conf.php");exit;
			}
		else
		{
			msg("修改失败","sys_conf.php");exit;
		}
} 
?>